<!--各区县卫计局使用情况-->
<template>
    <div class="administration">
        <div class="chart" id="chart_right3"></div>
    </div>
</template>

<script>
    export default {
        name: 'administration',
        mounted() {
            this.getEchartContent()
        },
        methods: {
            getEchartContent() {
                let myChart = this.$echarts.init(document.getElementById('chart_right3'));
                let colorList = [
                    '#CF4645','#B580B2','#29008A','#146A90','#8956FF','#70C9A8',
                    '#bfbfbf','#595959',
                    '#40a9ff','#1890ff',
                    '#ffd666','#ffc53d','#ffc53d','#ffc069','#ffa940','#fa8c16',
                    '#eccbd9','#ffadad','#ff6392','#ffc09f','#ffcb77','#ffe066','#ffd53e','#ffda3d','#adf7b6','#a0e8af','#80ed99','#07beb8','#17c3b2','#48cae4','#97d2fb','#83bcff','#91e5f6','#9381ff']
                let colorListLen = colorList.length
                let fontSizeList = [
                    12,12.5,13,13.5,14,14.5,
                    15,15.5,16,16.5,17,17.5,
                    18,18.5,19,19.5,20,20.5,
                    21,22,23,
                    24]
                let fontSizeListLen = fontSizeList.length
                let customLabel = {
                    color: colorList[Math.floor(Math.random()*colorListLen)],
                    fontSize: fontSizeList[Math.floor(Math.random()*fontSizeListLen)]
                }
                // let bgColor = '#010825'
                let canDraggable = false
                let option = {
                    color: ['#37A2DA', '#32C5E9', '#67E0E3'],
                    toolbox: {
                        show: true
                    },
                    series: [
                        {
                            type: 'graph',
                            layout: 'force',
                            force: {
                                repulsion: 80,
                                edgeLength: 10
                            },
                            roam: 'scale',
                            // symbol: '',
                            // symbolSize: 0,
                            label: {
                                show: true,
                                color: 'auto',
                                fontSize: 14
                            },
                            data: [
                                {
                                    name: '贵阳市',
                                    value: 2,
                                    draggable: canDraggable,
                                    label: {
                                        color: colorList[Math.floor(Math.random()*colorListLen)],
                                        fontSize: fontSizeList[Math.floor(Math.random()*fontSizeListLen)]
                                    }
                                },
                                {
                                    name: '贵阳市观山湖',
                                    value: 12,
                                    draggable: canDraggable,
                                    label: {
                                        color: colorList[Math.floor(Math.random()*colorListLen)],
                                        fontSize: fontSizeList[Math.floor(Math.random()*fontSizeListLen)]
                                    }
                                },
                                {
                                    name: '贵阳市南明区',
                                    value: 22,
                                    draggable: canDraggable,
                                    label: {
                                        color: colorList[Math.floor(Math.random()*colorListLen)],
                                        fontSize: fontSizeList[Math.floor(Math.random()*fontSizeListLen)]
                                    }
                                },
                                {
                                    name: '贵阳市清镇',
                                    value: 42,
                                    draggable: canDraggable,
                                    label: {
                                        color: colorList[Math.floor(Math.random()*colorListLen)],
                                        fontSize: fontSizeList[Math.floor(Math.random()*fontSizeListLen)]
                                    }
                                },
                                {
                                    name: '贵阳市息烽县',
                                    value: 52,
                                    draggable: canDraggable,
                                    label: {
                                        color: colorList[Math.floor(Math.random()*colorListLen)],
                                        fontSize: fontSizeList[Math.floor(Math.random()*fontSizeListLen)]
                                    }
                                },
                                {
                                    name: '贵阳市修文县',
                                    value: 62,
                                    draggable: canDraggable,
                                    label: {
                                        color: colorList[Math.floor(Math.random()*colorListLen)],
                                        fontSize: fontSizeList[Math.floor(Math.random()*fontSizeListLen)]
                                    }
                                },
                                {
                                    name: '贵阳市云岩区',
                                    value: 72,
                                    draggable: canDraggable,
                                    label: {
                                        color: colorList[Math.floor(Math.random()*colorListLen)],
                                        fontSize: fontSizeList[Math.floor(Math.random()*fontSizeListLen)]
                                    }
                                },
                                {
                                    name: '铜仁市德江县',
                                    value: 72,
                                    draggable: canDraggable,
                                    label: {
                                        color: colorList[Math.floor(Math.random()*colorListLen)],
                                        fontSize: fontSizeList[Math.floor(Math.random()*fontSizeListLen)]
                                    }
                                },
                                {
                                    name: '遵义市播州区',
                                    value: 72,
                                    draggable: canDraggable,
                                    label: {
                                        color: colorList[Math.floor(Math.random()*colorListLen)],
                                        fontSize: fontSizeList[Math.floor(Math.random()*fontSizeListLen)]
                                    }
                                }
                            ]
                        }
                    ]
                }

                myChart.setOption(option, true);
                window.addEventListener('resize', () => {
                    myChart.resize()
                })
            }
        }
    }
</script>

<style scoped lang="less">
    .administration {
        .chart {
            height: 3rem;
        }
    }

</style>
